package com.ruoyi.web.controller.app.borehole;

import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.validate.QueryGroup;
import com.ruoyi.web.domain.query.AddTemporaryCheckQuery;
import com.ruoyi.web.domain.query.TemporaryCheckPageQuery;
import com.ruoyi.web.domain.vo.TemporaryCheckVO;
import com.ruoyi.web.service.TemporaryCheckService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Slf4j
@Tag(name = "临时作业检查-app端")
@RestController
@RequestMapping("/app/temporaryCheck")
public class AppTemporaryCheckController {
    @Autowired
    private TemporaryCheckService temporaryCheckService;

    @Operation(summary = "新增临时作业检查")
    @RepeatSubmit
    @PostMapping("/addTemporaryCheck")
    public R<Void> addTemporaryCheck(@RequestBody AddTemporaryCheckQuery addTemporaryCheckQuery) {
        return temporaryCheckService.addTemporaryCheck(addTemporaryCheckQuery);
    }

    @Operation(summary = "临时作业检查列表页 - 分页查询")
    @GetMapping("/getTemporaryCheckPage")
    public TableDataInfo<TemporaryCheckVO> getTemporaryCheckPage(@Validated(QueryGroup.class) TemporaryCheckPageQuery temporaryCheckPageQuery, PageQuery pageQuery) {
        return temporaryCheckService.getTemporaryCheckPage(temporaryCheckPageQuery, pageQuery);
    }

    @Operation(summary = "临时作业检查详情")
    @GetMapping("/getTemporaryCheckDetail")
    public R<TemporaryCheckVO> getTemporaryCheckDetail(@RequestParam("id") Integer id) {
        return temporaryCheckService.getTemporaryCheckDetail(id);
    }
}
